namespace ghost
{    
    export class DialogUI extends GameUIBase{
        public back:GYSprite;
        public commitBtn:GYSprite;
        constructor(){
            super();
            let s= this;
            s.width = GameManager.DESIGN_WIDTH;
            s.height = GameManager.DESIGN_HEIGHT;
            s.back = new GYSprite;
            s.back.texture = Main.instance.getRes(Conf.scene + "bedGuide.png");
            s.addChild(s.back)
            s.commitBtn = new GYSprite;
            s.commitBtn.texture = Main.instance.getRes(Conf.scene + "commitBtn.png");
            s.addChild(s.commitBtn);
            s.commitBtn.on(Laya.Event.CLICK, s, ()=>{
                s.hide();
            });
            s.maskClkEnabled = false;
        }              
        
        public resize():void
        {
            let s = this;
            super.resize();
            s.back.x = s._module.frameBound.x + (s._module.frameBound.width - s.back.width >> 1);
            s.back.y = s._module.frameBound.y + (s._module.frameBound.height - s.back.height >> 1) - 100;
            s.commitBtn.x = s.back.x + (s.back.width - s.commitBtn.width >> 1);
            s.commitBtn.y = s.back.y + 227;
        }
        public show(pr:Laya.Sprite=null, mask:boolean=true, tween:boolean=true, type:number=1):void
        {
            super.show(pr, mask, tween);
            let s= this;
            if(type == 1)
                s.back.texture = Main.instance.getRes(Conf.scene + "countGuide.png");
            else if(type == 2)
                s.back.texture = Main.instance.getRes(Conf.scene + "bedGuide.png");
            else if(type == 3)
                s.back.texture = Main.instance.getRes(Conf.scene + "doorGuide.png");
            else
                s.back.texture = Main.instance.getRes(Conf.scene + "towerGuide.png");            
        }
        public hide():void{
            super.hide();            
            let s= this;
            GameDispatcher.instance.event(GameEvent.GUIDE_COMPLETE);
        }
    }
}